import { registerPanelItemProvider } from '@ibiz-template/runtime';
import { App } from 'vue';
import { withInstall } from '@ibiz-template/vue3-util';
import { PanelItemPlugin } from './panel-item';
import { PanelItemPluginProvider } from './panel-item.provider';

export * from './panel-item.controller';

export const IBizPanelItemPlugin = withInstall(
  PanelItemPlugin,
  function (v: App) {
    // 全局注册面板项插件组件
    v.component(PanelItemPlugin.name, PanelItemPlugin);
    // 全局注册面板项适配器，CUSTOM是插件类型，R9PanelItemPluginId是插件标识
    registerPanelItemProvider(
      'CUSTOM_R9PanelItemPluginId',
      () => new PanelItemPluginProvider(),
    );
  },
);

export default IBizPanelItemPlugin;
